import * as constant  from './constant'
import axios from 'axios'
const getRemendData= (result) => ({
  type: constant.GET_REMEND,
  title: result.title,
  nav: result.nav,
  notice1: result.notice1,
  notice2: result.notice2,
  list: result.list,
  list2: result.list2,
  writerList: result.writerList,
  focusList: result.focusList

})
export const loadOpen = () => ({
    type: constant.CHANGE_LOAD_OPEN
})
export const loadClose = () => ({
    type: constant.CHANGE_LOAD_CLOSE
})
export const load2Open = () => ({
    type: constant.CHANGE_LOAD2_OPEN
})
export const load2Close = () => ({
    type: constant.CHANGE_LOAD2_CLOSE
})
export const helpHint = () => ({
    type: constant.HELP_VISIBLE
})
export const getData = () => {
    return (dispatch) => {
        axios.get('/api/remmend.json')
        .then((res) => {
            const result = res.data.data;
            console.log(result)
            dispatch(getRemendData(result));
        })
    }
}